package com.itheima.homework.homework4;

public class Demo4 {
    public static void main(String[] args) {
        Worker worker1 = new Worker("张三", 23);
        Worker worker2 = new Worker("李四", 24);
        Worker worker3 = new Worker("张三", 23);
        Worker worker4 = new Worker("张三", 24);
        Worker[] workers = {worker1, worker2, worker3, worker4};
        for (int i = 0; i < workers.length; i++) {
            Worker work1 = workers[i];
            boolean flag = false;
            for (int j = 0; j < workers.length; j++) {
                Worker work2 = workers[j];
                if (workers[i] != workers[j] && ( work1.equals(work2) )) {
                    flag = true;
                }
            }
            if (flag) {
                System.out.println(workers[i] + "获得了缘分大礼包");
            } else {
                System.out.println(workers[i] + "获得了普通大礼包");
            }


        }

    }
}
